import { useState, useEffect } from "react";
import axios from "axios";
function Home() {
    // const mapStateToProps = ({ shop }) => ({ shop });
    let [shop, setShop] = useState([])
    useEffect(() => {
        axios.get('http://localhost:3000/shop').then(res => {
            setShop(res.data)
        })
    })
   
    return (
        <div>
            {
                shop.map(item => {
                    return (
                        <div key={item.id}>
                            <p>{item.name}</p>
                            <p>￥{item.price}</p>
                            <p>
                                <button >-</button>
                                {item.num}
                                <button>+</button>
                            </p>
                        </div>
                    )
                })
            }
        </div>
    )
}
export default Home;